﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WCS.Infrastructure.Attr;
using WCS.Infrastructure.Dto.Common;
using WCS.Infrastructure.Dto.Request.Epaylinks;
using WCS.Infrastructure.Dto.Request.Order;
using WCS.Infrastructure.Dto.Request.Organization;
using WCS.Infrastructure.Dto.Request.Payment;
using WCS.Infrastructure.Dto.Request.ReportForm;
using WCS.Infrastructure.Dto.Response.Common;
using WCS.Infrastructure.Dto.Response.Epaylinks;
using WCS.Infrastructure.Dto.Response.Payment;
using WCS.Infrastructure.EFCore;
using static System.Runtime.InteropServices.JavaScript.JSType;

namespace WCS.Service.Interface
{

    [Provider]
    public interface IPaymentService
    {
        
        /// <summary>
        /// 新增交易订单
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<ApiResult> AddOrdersAsync(OrderCreateRequestDto dto);

        /// <summary>
        /// 新增订单模拟数据（仅自动运行脚本可用）
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<ApiResult> AddOrdersSimulationAsync(OrderCreateRequestDto dto);

        /// <summary>
        /// 新增订单测试数据（不涉及真实支付）
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<ApiResult> AddOrdersTestAsync(OrderCreateRequestDto dto);

        /// <summary>
        /// 微信公众号/小程序支付
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<ApiResult> MiniProgramPaymentAsync(MiniProgramPaymentRequestDto dto);

        /// <summary>
        /// 支付结果回调
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<EpaylinksResponseDto> ProcessPaymentResultNotificationAsync(PaymentResultNotificationRequestDto dto);

        /// <summary>
        /// 支付结果查询
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<ApiResult> QueryPaymentResultAsync(PaymentQueryRequestDto dto);

        /// <summary>
        /// 主动查询并更新付款状态
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<ApiResult> ManualQueryAndUpdateOrder(PaymentQueryRequestDto dto);

        /// <summary>
        /// 获取交易订单列表（ToB）
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<ApiResult> GetOrdersListToBAsync(OrderQueryRequestDto dto);

        /// <summary>
        /// 获取交易订单列表（ToC）
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<ApiResult> GetOrdersListToCAsync(OrderQueryRequestDto dto);

        /// <summary>
        /// 获取消费统计数据（C端用户）
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<ApiResult> GetConsumptionStatistics();

        /// <summary>
        /// 获取单个交易订单详细信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<ApiResult> GetOrdersAsync(OrderQueryRequestDto dto);

        /// <summary>
        /// 新增结算记录
        /// </summary>
        /// <param name="settlementTime"></param>
        /// <returns></returns>
        Task<ApiResult> AddSettlementRecordAsync(DateTime? settlementTime);

        /// <summary>
        /// 获取结算记录列表
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<ApiResult> GetSettlementRecordListAsync(SettlementRecordQueryRequestDto dto);

        /// <summary>
        /// 新增账户交易记录
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<ApiResult> AddAccountTransactionAsync(AccountTransactionRequestDto dto, bool useTransaction = true);

        /// <summary>
        /// 新增支付平台交易记录
        /// </summary>
        /// <param name="dto"></param>
        /// <param name="useTransaction"></param>
        /// <returns></returns>
        Task<ApiResult> AddPaymentPlatformTransactionAsync(AccountTransactionRequestDto dto, bool useTransaction = true);

        /// <summary>
        /// 新增支付平台
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<ApiResult> AddPaymentPlatformAsync(PaymentPlatformCreateRequestDto dto);

        /// <summary>
        /// 获取支付平台列表
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<ApiResult> GetPaymentPlatformListAsync(PaymentPlatformQueryRequestDto dto);

        /// <summary>
        /// 费率计算
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<ApiResult> CalculateRateAsync(SplitWithdrawalRequestDto dto);

        /// <summary>
        /// 分账并提现
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<ApiResult> SplitWithdrawalAsync(SplitWithdrawalRequestDto dto);

        /// <summary>
        /// 平台方分账提现
        /// </summary>
        /// <param name="Amount"></param>
        /// <returns></returns>
        Task<ApiResult> PlatformSplitWithdrawalAsync(long Amount);

        /// <summary>
        /// 分账结果回调通知
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<EpaylinksResponseDto> HandleMerchantSplitResultNotificationAsync(SplitResultNotificationRequest dto);

        /// <summary>
        /// 商户分账结果查询
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<ApiResult> MerchantSplitResultQueryAsync(SplitResultQueryRequestDto dto);

        /// <summary>
        /// 新增分账商户提现记录
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<ApiResult> AddSubMerchantWithdrawalRecordAsync(AddWithdrawalRequest dto);

        /// <summary>
        /// 分账商户提现结果回调通知
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<EpaylinksResponseDto> HandleSubMerchantWithdrawalResultNotificationAsync(SubMerchantWithdrawalResultNotificationRequestDto dto);

        /// <summary>
        /// 分账商户提现结果查询
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<ApiResult> SubMerchantWithdrawalResultQueryAsync(SubMerchantWithdrawalResultQueryRequestDto dto);

        /// <summary>
        /// 获取当前用户提现记录列表
        /// </summary>
        /// <returns></returns>
        Task<ApiResult> GetWithdrawalRecordListAsync(BaseRequestDto dto);

        /// <summary>
        /// 获取单个提现记录详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<ApiResult> GetWithdrawalRecordDetailAsync(string id);

        /// <summary>
        /// 新增订单退款记录
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<ApiResult> AddOrderRefundRecordAsync(AddOrderRefundRecordRequestDto dto);

        /// <summary>
        /// 订单退款结果回调通知
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<EpaylinksResponseDto> HandleOrderRefundResultNotificationAsync(RefundResultNotificationRequestDto dto);

        /// <summary>
        /// 订单退款结果查询
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<ApiResult> OrderRefundRecordQueryAsync(RefundResultQueryRequestDto dto);

        /// <summary>
        /// 获取订单退款记录列表
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        Task<ApiResult> GetOrderRefundRecordListAsync(string orderId);

        /// <summary>
        /// 获取报表
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<ApiResult> GetReportFormAsync(ReportFormRequestDto dto);

        /// <summary>
        /// 获取收款记录
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<ApiResult> GetCollectionRecordListAsync(ReportFormRequestDto dto);

        /// <summary>
        /// 获取今日营业额
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<ApiResult> GetTodayTurnoverAsync(TodayTurnoverRequestDto dto);

        Task<ApiResult> GetPlatformHomepageAsync(DateTime dateTime);

    }
}
